package com.wenlin.myproduction.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.wenlin.myproduction.R;
import com.wenlin.myproduction.base.BaseSwipeActivity;
import com.wenlin.myproduction.util.ToastUtils;
import com.wenlin.myproduction.util.UI;
import com.wenlin.myproduction.util.ValCommon;
import com.wenlin.myproduction.widget.BombView;

import butterknife.BindView;
import butterknife.OnClick;

public class BombViewActivity extends BaseSwipeActivity {

    @BindView(R.id.bv)
    BombView bv;
    @BindView(R.id.tv_custom)
    TextView tvCustom;

    @Override
    public int getContentView() {
        return R.layout.activity_bomb_view;
    }

    public static void start(Activity activity) {
        Intent intent = new Intent(activity, BombViewActivity.class);
        activity.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle(ValCommon.BOOM_VIEW);

    }

    @OnClick({R.id.tv_reset, R.id.tv_show, R.id.tv_custom, R.id.tv_hide})
    void click(View view) {
        int id = view.getId();
        if (id == R.id.tv_reset) {
            bv.autoSet();
        } else if (id == R.id.tv_show) {
            bv.show();
        } else if (id == R.id.tv_custom) {
            if (UI.getText(tvCustom).equals("调整飞机") && bv.setEditMode()) {
                ToastUtils.getInstance().showInfo("双击飞机可旋转");
                UI.setText(tvCustom, "调整完毕");
            } else if (bv.editComplete()) {
                UI.setText(tvCustom, "调整飞机");
            }
        } else if (id == R.id.tv_hide) {
            bv.hide();
        }
    }
}
